﻿// 功能：
// 描述：
// 作者：温伟鹏
// 日期：2010/6/8 13:16:17

using System;
using MeizuSDK.Presentation;
using MeizuSDK.Drawing;

namespace Demo
{
    class IconToolBarWindow : Form
    {
        private IconToolBar toolBar;

        public IconToolBarWindow()
        {
            toolBar = new IconToolBar();
            toolBar.SetButtonIcon(0, MzGraphicsAPI.GetMzResV2ModuleHandle(), NativeResourceType.RT_RCDATA, ((ushort)MzResV2.Png_Back).ToString());
            toolBar.SetButtonIcon(1, MzGraphicsAPI.GetMzResV2ModuleHandle(), NativeResourceType.RT_RCDATA, ((ushort)MzResV2.Png_Back).ToString());
            toolBar.SetButtonIcon(2, MzGraphicsAPI.GetMzResV2ModuleHandle(), NativeResourceType.RT_RCDATA, ((ushort)MzResV2.Png_Back).ToString());
            toolBar.SetButtonIcon(3, MzGraphicsAPI.GetMzResV2ModuleHandle(), NativeResourceType.RT_RCDATA, ((ushort)MzResV2.Png_Back).ToString());
            toolBar.ButtonClicked += new IconToolBarButtonClickedEventHandler(toolBar_ButtonClicked);

            Controls.Add(toolBar);
        }

        void toolBar_ButtonClicked(object sender, IconToolBarButtonClickedEventArgs e)
        {
            switch (e.Index)
            {
                case 0:
                    this.Close();
                    break;
                case 1:
                    MessageBox.Show("您点击了第二个按钮", "提示");
                    break;
                case 2:
                    MessageBox.Show("您点击了第三个按钮", "提示");
                    break;
                case 3:
                    MessageBox.Show("您点击了第四个按钮", "提示");
                    break;
            }
        }
    }
}
